package com.sunwayhorizo.health.ets.base.persistent;

import java.io.Serializable;

import java.sql.Timestamp;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;

@Entity
@TableGenerator(name = "Version_IdGenerator", table = "ET_Id_Generator", pkColumnName = "pkColumn", valueColumnName = "valueColumn", pkColumnValue = "Version_Id")
@NamedQuery(name = "EtVersions.findAll", query = "select o from EtVersions o")
//@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@Table(name = "ET_VERSIONS")
public class EtVersions implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "Version_IdGenerator")
	@Column(name = "VERSION_ID", nullable = false)
	private String versionId;
	
	@Column(name = "VERSION_NAME", nullable = false)
	private String versionName;
	
	@Column(name = "VERSION_DESC")
	private String versionDesc;
	
	@Column(name = "RETIRED_DATE")
	private Timestamp retiredDate;
	
	@Column(name = "STATUS_CODE", nullable = false)
	private String statusCode;
	
	@Column(name = "LOAD_DATE")
	private Timestamp loadDate;
	
	@Column(name = "DEFAULT_FLAG", nullable = false)
	private String defaultFlag;
	
	@Column(name = "HISTORY_TYPE_CODE")
	private String historyTypeCode;

	@Column(name = "CREATED_BY", nullable = false)
	private Long createdBy;
	
	@Column(name = "CREATED_BY_NAME", nullable = false)
	private String createdByName;
	
	@Column(name = "CREATION_DATE", nullable = false)
	private Timestamp creationDate;
	
	@Column(name = "LAST_UPDATED_BY", nullable = false)
	private Long lastUpdatedBy;
	
	@Column(name = "LAST_UPDATED_BY_NAME", nullable = false)
	private String lastUpdatedByName;
	
	@Column(name = "LAST_UPDATE_DATE", nullable = false)
	private Timestamp lastUpdateDate;
	
	@Column(name = "LAST_UPDATE_LOGIN")
	private Long lastUpdateLogin;

	@OneToMany(mappedBy = "etVersions")
	private List<EtDescriptions> etDescriptionsList = new ArrayList<EtDescriptions>();
	
	@OneToMany(mappedBy = "etVersions")
	private List<EtConcepts> etConceptsList = new ArrayList<EtConcepts>();

	@ManyToOne
	@JoinColumn(name = "CODINGSCHEME_ID")
	private EtCodingSchemes etCodingSchemes;

	public EtVersions() {
		Long i = new Long(1);
		Timestamp nowTime = new Timestamp(new Date().getTime());

		createdBy = i;
		creationDate = nowTime;
		lastUpdatedBy = i;
		lastUpdateDate = nowTime;
		lastUpdateLogin = i;
	}

	public Long getCreatedBy() {
		return createdBy;
	}

	public void setCreatedBy(Long createdBy) {
		this.createdBy = createdBy;
	}

	public Timestamp getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Timestamp creationDate) {
		this.creationDate = creationDate;
	}

	public String getDefaultFlag() {
		return defaultFlag;
	}

	public void setDefaultFlag(String defaultFlag) {
		this.defaultFlag = defaultFlag;
	}

	public String getHistoryTypeCode() {
		return historyTypeCode;
	}

	public void setHistoryTypeCode(String historyTypeCode) {
		this.historyTypeCode = historyTypeCode;
	}

	public Long getLastUpdatedBy() {
		return lastUpdatedBy;
	}

	public void setLastUpdatedBy(Long lastUpdatedBy) {
		this.lastUpdatedBy = lastUpdatedBy;
	}

	public Timestamp getLastUpdateDate() {
		return lastUpdateDate;
	}

	public void setLastUpdateDate(Timestamp lastUpdateDate) {
		this.lastUpdateDate = lastUpdateDate;
	}

	public Long getLastUpdateLogin() {
		return lastUpdateLogin;
	}

	public void setLastUpdateLogin(Long lastUpdateLogin) {
		this.lastUpdateLogin = lastUpdateLogin;
	}

	public Timestamp getLoadDate() {
		return loadDate;
	}

	public void setLoadDate(Timestamp loadDate) {
		this.loadDate = loadDate;
	}

	public Timestamp getRetiredDate() {
		return retiredDate;
	}

	public void setRetiredDate(Timestamp retiredDate) {
		this.retiredDate = retiredDate;
	}

	public String getStatusCode() {
		return statusCode;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}

	public String getVersionDesc() {
		return versionDesc;
	}

	public void setVersionDesc(String versionDesc) {
		this.versionDesc = versionDesc;
	}

	public String getVersionId() {
		return versionId;
	}

	public void setVersionId(String versionId) {
		this.versionId = versionId;
	}

	public String getVersionName() {
		return versionName;
	}

	public void setVersionName(String versionName) {
		this.versionName = versionName;
	}

	public EtCodingSchemes getEtCodingSchemes() {
		return etCodingSchemes;
	}

	public void setEtCodingSchemes(EtCodingSchemes etCodingSchemes) {
		this.etCodingSchemes = etCodingSchemes;
	}

	public List<EtDescriptions> getEtDescriptionsList() {
		return etDescriptionsList;
	}

	public void setEtDescriptionsList(List<EtDescriptions> etDescriptionsList) {
		this.etDescriptionsList = etDescriptionsList;
	}

	public EtDescriptions addEtDescriptions(EtDescriptions etDescriptions) {
		getEtDescriptionsList().add(etDescriptions);
		etDescriptions.setEtVersions(this);
		return etDescriptions;
	}

	public EtDescriptions removeEtDescriptions(EtDescriptions etDescriptions) {
		getEtDescriptionsList().remove(etDescriptions);
		etDescriptions.setEtVersions(null);
		return etDescriptions;
	}

	public List<EtConcepts> getEtConceptsList() {
		return etConceptsList;
	}

	public void setEtConceptsList(List<EtConcepts> etConceptsList) {
		this.etConceptsList = etConceptsList;
	}

	public EtConcepts addEtConcepts(EtConcepts etConcepts) {
		getEtConceptsList().add(etConcepts);
		etConcepts.setEtVersions(this);
		return etConcepts;
	}

	public EtConcepts removeEtConcepts(EtConcepts etConcepts) {
		getEtConceptsList().remove(etConcepts);
		etConcepts.setEtVersions(null);
		return etConcepts;
	}

	public String getCreatedByName() {
		return createdByName;
	}

	public void setCreatedByName(String createdByName) {
		this.createdByName = createdByName;
	}

	public String getLastUpdatedByName() {
		return lastUpdatedByName;
	}

	public void setLastUpdatedByName(String lastUpdatedByName) {
		this.lastUpdatedByName = lastUpdatedByName;
	}
	
	
}
